home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / What's New / Sample Code / Networking / MoreNetworkSetup / NetworkSetup / NetworkSetupHelpers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-10  |  4.0 KB  |  110 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        NetworkSetupHelpers.h
  3.  
  4.     Contains:    High-level network preference routines.
  5.  
  6.     Written by:    Quinn
  7.  
  8.     Copyright:    Copyright © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <5>    10/11/98    Quinn   Convert "MorePrefix.h" to "MoreSetup.h".
  21.          <4>     9/11/98    Quinn   AppleTalk on/off support.
  22.          <3>     9/11/98    Quinn   Add "TCP will dial" code.
  23.          <2>     5/11/98    Quinn   Fix header.
  24.          <1>     5/11/98    Quinn   First checked in.
  25. */
  26.  
  27. #pragma once
  28.  
  29. /////////////////////////////////////////////////////////////////
  30. // MoreIsBetter Setup
  31.  
  32. #include "MoreSetup.h"
  33.  
  34. /////////////////////////////////////////////////////////////////
  35. // Mac OS Interfaces
  36.  
  37. #include <MacTypes.h>
  38. #include <NetworkSetup.h>
  39.  
  40. /////////////////////////////////////////////////////////////////
  41. // Routines to Enumerate and Switch TCP/IP and AppleTalk Preferences
  42.  
  43. struct NSHConfigurationEntry {
  44.     Str255     name;                    // user-visible name of the configuration
  45.     Boolean selected;                // true if this configuration is currently active
  46.     SInt16     cookie;                    // cookies for use by this library
  47.     CfgEntityRef cookie2;
  48.     CfgEntityInfo cookie3;
  49. };
  50. typedef struct NSHConfigurationEntry NSHConfigurationEntry;
  51. typedef NSHConfigurationEntry *NSHConfigurationListPtr;
  52. typedef NSHConfigurationListPtr *NSHConfigurationListHandle;
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58. extern pascal ItemCount NSHCountConfigurationList(NSHConfigurationListHandle configList);
  59.     // Returns a count of the number of entries in configList.
  60.     
  61. extern pascal OSStatus  NSHGetConfigurationList(OSType protocol, NSHConfigurationListHandle configList);
  62.     // Reads the list of configurations for the specific protocol,
  63.     // placing a NSHConfigurationEntry in configList for each one.
  64.     // configList must be a non-locked handle allocated by you.
  65.     // The routine will resize it appropriate.  Specify protocol
  66.     // using one of the constants declared in "NetworkSetup.h",
  67.     // ie kOTTCPv4NetworkConnection or kOTAppleTalkNetworkConnection.
  68.     // Only handles those two protocols at the moment.
  69.  
  70. extern pascal OSStatus  NSHSelectConfiguration(OSType protocol, const NSHConfigurationEntry *chosenEntry);
  71.     // Given an entry from the configList generated by the previous
  72.     // routine, this routine switches the network protocol to use
  73.     // that configuration.  Specify protocol
  74.     // using one of the constants declared in "NetworkSetup.h",
  75.     // ie kOTTCPv4NetworkConnection or kOTAppleTalkNetworkConnection.
  76.     // Only handles those two protocols at the moment.
  77.  
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81.  
  82. /////////////////////////////////////////////////////////////////
  83. // TCP/IP Will Dial
  84.  
  85. enum {
  86.     kNSHTCPDialUnknown = 0,
  87.     kNSHTCPDialTCPDisabled,
  88.     kNSHTCPDialYes,
  89.     kNSHTCPDialNo
  90. };
  91.  
  92. extern pascal OSStatus NSHTCPWillDial(UInt32 *willDial);
  93.     // This routine returns, in willDial, a flag indicating
  94.     // whether opening a TCP/IP provider will cause the modem 
  95.     // to dial.  You must call InitOpenTransport before calling
  96.     // this routine.  [Not because it allocates memory but
  97.     // because it calls OTInetGetInterfaceInfo.]
  98.  
  99. /////////////////////////////////////////////////////////////////
  100. // AppleTalk On/Off
  101.  
  102. extern pascal OSStatus NSHIsAppleTalkActive(Boolean *active);
  103.     // Sets *active to true if the AppleTalk stack is active.
  104.  
  105. extern pascal OSStatus HSHSetAppleTalkActive(Boolean active);
  106.     // Sets the active state of the AppleTalk stack to the active
  107.     // parameter.
  108.  
  109. /////////////////////////////////////////////////////////////////
  110.